﻿using System.Drawing;
using System.Collections;

namespace TestAnimation
{
    class Background
    {
        readonly Graphics graphics;
        readonly int scrWidth;
        readonly int scrHeight;
        readonly ArrayList stars;

        public Background(Graphics g, int scrWidth, int scrHeight)
        {
            graphics = g;
            this.scrWidth = scrWidth;
            this.scrHeight = scrHeight;
            stars = new ArrayList();
            for (int i=0; i<Globals.stars; i++)
                stars.Add( new Point(Helper.GetRnd(scrWidth),Helper.GetRnd(scrHeight)));
        }
        public void Draw()
        {
            graphics.FillRectangle(Brushes.Black, 0,0,scrWidth,scrHeight);   //clear the screen
            foreach (Point p in stars)
            {
                int i = Helper.GetRnd(155) + 100;
                var pen = new Pen(Color.FromArgb(i, i, i));
                graphics.DrawEllipse(pen, p.X, p.Y, 1, 1);
            }
        }
    }
}
